//
//  FriendsViewController.h
//  Guazi
//
//  Created by koolearn on 11-5-25.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
#import "TwitterClient.h"
#import "WEPopoverController.h"
#import "PopMenuContentDelegate.h"



@interface FriendsViewController : UITableViewController <UISearchBarDelegate,MFMessageComposeViewControllerDelegate,WEPopoverControllerDelegate, UIPopoverControllerDelegate, PopMenuContentDelegate> {
    
    NSMutableArray* groups;
    
    TwitterClient* client;
	
	WEPopoverController *popoverController;
    NSInteger selectedMenuItem;
    
    NSArray* allUsers;
    NSArray* filterUsers;
    
    UISearchBar* searchBar;
    BOOL isSearching;
    
    //线程队列
    NSOperationQueue* operationQueue;
    
    BOOL isLoaded;
}


@property (nonatomic, retain) NSMutableArray* groups;
@property (nonatomic, retain) NSArray* allUsers;
@property (nonatomic, retain) NSArray* filterUsers;
@property (nonatomic, assign) BOOL isLoaded;

@property (nonatomic, retain) WEPopoverController *popoverController;
@property (nonatomic, retain) UISearchBar* searchBar;

- (NSArray*) loadLocalContacts;

- (void) refreshAddGroup:(FriendGroup*)group;
- (void) refreshDeleteGroup:(FriendGroup*)group;
- (void) refreshGroup:(FriendGroup*)group;

- (void) refreshUsersInGroup:(FriendGroup*)group;
- (void) refreshUsersInGroup:(FriendGroup*)group toUsers:(NSArray*)toUsers;

//设置用户分组后刷新
- (void) refreshSetUserGroup:(User*)user oldGroups:(NSArray*)oldGroups newGroups:(NSArray*)newGroups;

//取消关注后的刷新
- (void) refreshDestroyFriendship:(sqlite3_int64)userId;
- (void) refreshCreateFriendship:(User*)user;

//切换用户的刷新操作
- (void) refreshSwitchUser;

//刷新数据
- (void) refreshTableView;

//展开分组
- (void) sectionDidSelected:(NSInteger)section;

@end
